<?php

// STORES JUST THE TITLE, USER, AND BFKEY

/* Data Entry
 *
 * Takes user input from JavaScript, checks user authentication, and adds data to database
 */


require("./dbconnect.inc.php");

// Grab data
extract ($_POST);

// Process
mysql_connect($host,$dbuser,$dbpassword);
@mysql_select_db($database) or die( "Unable to select database");


// Enter data
$query = sprintf("INSERT INTO filedata (title, username, bfkey) VALUES ('%s','%s','%s')", $title, $user, $bfkey);
		
if(mysql_query($query)){
	echo "<p><span style=\"color:blue;\">Data entered.</span></p>";
	}
else{
	echo"<p><span style=\"color:red;\">Failed to enter data:</span></p>";
	echo "Title: ".$title;
	echo "<br>";
	echo "Data: ".$user;
	echo "<br>";
	echo "Key: ".$bfkey;
	}

mysql_close();

?>